package demo;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2023-03-14
 * Time: 22:33
 */

/**
 * 高精度减法 计算大数a-b
 * 思路:
 */
public class Main8 {
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        List<Integer> la = new ArrayList<>();
        List<Integer> lb = new ArrayList<>();
        List<Integer> lc = null;
        for(int i=a.length()-1; i>=0;i--){
            la.add(a.charAt(i)-'0');
        }
        for(int i=b.length()-1; i>=0;i--){
            lb.add(b.charAt(i)-'0');
        }
        //保证 a>b
        if(cmp(la, lb)){
             lc = sub(la, lb);
        } else {
             lc = sub(lb, la);
             System.out.printf("-");
        }

        for(int i=lc.size()-1; i>=0; i--){
            System.out.printf("%d", lc.get(i));
        }
    }

    private static List<Integer> sub(List<Integer> la, List<Integer> lb) {
        List<Integer> lc = new ArrayList<>();
        int t = 0;
        for(int i=0; i<la.size(); i++){
            t = la.get(i)-t;
            if( i<lb.size()) t -= lb.get(i);
            lc.add( (t+10)%10);
            if(t<0) t=1;
            else t=0;
        }
        //去掉前导0
        while(lc.size() > 1 && lc.get(lc.size()-1) == 0){
             lc.remove(lc.size()-1);
        }
        return lc;
    }

    //比较a,b两个数是否相等
    private static boolean cmp(List<Integer> la, List<Integer> lb) {
        if(la.size() != lb.size()) return la.size()>lb.size();
        for(int i=la.size()-1; i>=0; i-- ){
            if(la.get(i) != lb.get(i)){
                return la.get(i) > lb.get(i);
            }
        }
        return true;
    }

}
